package com.raven.craft.code.generator.mysql.repo.mapper;

import com.raven.craft.code.generator.mysql.repo.entity.Column;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author raven
 * @date 2019-03-22 23:06
 */
@Mapper
public interface ColumnMapper {

    @Results(id = "columnMap", value = {
            @Result(property = "field", column = "Field"),
            @Result(property = "columnType", column = "Type"),
            @Result(property = "collation", column = "Collation"),
            @Result(property = "nullable", column = "Null"),
            @Result(property = "keyType", column = "Key"),
            @Result(property = "defaultValue", column = "Value"),
            @Result(property = "extra", column = "Extra"),
            @Result(property = "privileges", column = "Privileges"),
            @Result(property = "comment", column = "Comment")
    })
    @Select(value = "show full columns from ${tableName}")
    List<Column> listAll(@Param("tableName") String tableName);
}
